﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;

namespace MusicExplorer.Tools
{
    public static class Net
    {
        public static async Task<byte[]> GetPartialWebPageContent(string url, int byteToLoads)
        {
            using(var client = new HttpClient())
            {
                using (var request = new HttpRequestMessage(HttpMethod.Get, @"http://realaudio.rferl.org/voa/LERE/2013/11/08/fd15297f-d561-400d-a4d9-c194b70d1dca.mp3"))
                {
                    var operation = client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
                    byte[] responseBuffer = new byte[12];
                    using (var responseStream = await operation.Result.Content.ReadAsStreamAsync())
                    {
                        var bytes = await responseStream.ReadAsync(responseBuffer, 0, responseBuffer.Length);
                    }
                }
            }
            
            return null;
        }
    }
}
